const Router = require("koa-router")
const router = new Router();
const ShopcarModel = require("../../models/shopcar")
router.post("/api/delete",async ctx=>{
    var {id} = ctx.request.body;
    // console.log(id)
    try{
        await ShopcarModel.deleteOne({_id:id})
        ctx.body = {
            code:200,
            msr:"删除成功"
        }
    }catch(err){
        // console.log(err);
        ctx.body = {
            code:400,
            msg:"请求的参数错误",
            request:"POST /api/delete"
        }
    }
})
module.exports = router;